// $ANTLR : "RecorredorHueco.g" -> "RecorredorHueco.java"$

	package procesador.tablas;
	
	import procesador.Tabla;
	import procesador.Campo;
	import java.util.List;
	import java.util.ArrayList;

import antlr.TreeParser;
import antlr.Token;
import antlr.collections.AST;
import antlr.RecognitionException;
import antlr.ANTLRException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.collections.impl.BitSet;
import antlr.ASTPair;
import antlr.collections.impl.ASTArray;


public class RecorredorHueco extends antlr.TreeParser       implements RecorredorHuecoTokenTypes
 {
public RecorredorHueco() {
	tokenNames = _tokenNames;
}

	public final void tablas(AST _t) throws RecognitionException {
		
		AST tablas_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			AST __t498 = _t;
			AST tmp1_AST_in = (AST)_t;
			match(_t,TABLAS);
			_t = _t.getFirstChild();
			{
			_loop500:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_t.getType()==IDENT)) {
					tabla(_t);
					_t = _retTree;
				}
				else {
					break _loop500;
				}
				
			} while (true);
			}
			_t = __t498;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void tabla(AST _t) throws RecognitionException {
		
		AST tabla_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		AST i = null;
		
		try {      // for error handling
			AST __t502 = _t;
			i = _t==ASTNULL ? null :(AST)_t;
			match(_t,IDENT);
			_t = _t.getFirstChild();
			campos(_t);
			_t = _retTree;
			claves(_t);
			_t = _retTree;
			registros(_t);
			_t = _retTree;
			_t = __t502;
			_t = _t.getNextSibling();
			System.out.println("\tTabla procesada: " + i.getText());
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void campos(AST _t) throws RecognitionException {
		
		AST campos_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			AST __t504 = _t;
			AST tmp2_AST_in = (AST)_t;
			match(_t,CAMPOS);
			_t = _t.getFirstChild();
			{
			_loop506:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_t.getType()==CAMPO)) {
					campo(_t);
					_t = _retTree;
				}
				else {
					break _loop506;
				}
				
			} while (true);
			}
			_t = __t504;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void claves(AST _t) throws RecognitionException {
		
		AST claves_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			AST __t511 = _t;
			AST tmp3_AST_in = (AST)_t;
			match(_t,PRIMARYKEY);
			_t = _t.getFirstChild();
			{
			int _cnt513=0;
			_loop513:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_t.getType()==IDENT)) {
					AST tmp4_AST_in = (AST)_t;
					match(_t,IDENT);
					_t = _t.getNextSibling();
				}
				else {
					if ( _cnt513>=1 ) { break _loop513; } else {throw new NoViableAltException(_t);}
				}
				
				_cnt513++;
			} while (true);
			}
			_t = __t511;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void registros(AST _t) throws RecognitionException {
		
		AST registros_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			AST __t515 = _t;
			AST tmp5_AST_in = (AST)_t;
			match(_t,REGISTROS);
			_t = _t.getFirstChild();
			{
			_loop517:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_t.getType()==REGISTRO)) {
					registro(_t);
					_t = _retTree;
				}
				else {
					break _loop517;
				}
				
			} while (true);
			}
			_t = __t515;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void campo(AST _t) throws RecognitionException {
		
		AST campo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			AST __t508 = _t;
			AST tmp6_AST_in = (AST)_t;
			match(_t,CAMPO);
			_t = _t.getFirstChild();
			AST tmp7_AST_in = (AST)_t;
			match(_t,IDENT);
			_t = _t.getNextSibling();
			tipo(_t);
			_t = _retTree;
			_t = __t508;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void tipo(AST _t) throws RecognitionException {
		
		AST tipo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case NUMERIC:
			{
				AST tmp8_AST_in = (AST)_t;
				match(_t,NUMERIC);
				_t = _t.getNextSibling();
				break;
			}
			case CHAR:
			{
				AST tmp9_AST_in = (AST)_t;
				match(_t,CHAR);
				_t = _t.getNextSibling();
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void registro(AST _t) throws RecognitionException {
		
		AST registro_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			AST __t519 = _t;
			AST tmp10_AST_in = (AST)_t;
			match(_t,REGISTRO);
			_t = _t.getFirstChild();
			{
			_loop521:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_t.getType()==CADENA||_t.getType()==NUMERO)) {
					atributo(_t);
					_t = _retTree;
				}
				else {
					break _loop521;
				}
				
			} while (true);
			}
			_t = __t519;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void atributo(AST _t) throws RecognitionException {
		
		AST atributo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case CADENA:
			{
				AST tmp11_AST_in = (AST)_t;
				match(_t,CADENA);
				_t = _t.getNextSibling();
				break;
			}
			case NUMERO:
			{
				AST tmp12_AST_in = (AST)_t;
				match(_t,NUMERO);
				_t = _t.getNextSibling();
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"TABLAS",
		"CAMPOS",
		"CAMPO",
		"REGISTROS",
		"REGISTRO",
		"PRIMARYKEY",
		"\"@\"",
		"IDENT",
		"\"(\"",
		"\")\"",
		"\":\"",
		"SALTO_LINEA",
		"\",\"",
		"\"/\"",
		"CHAR",
		"NUMERIC",
		"CADENA",
		"NUMERO"
	};
	
	}
	
